package org.yoki.edu.common;

import org.yoki.edu.common.utils.encrypt.EncryptUtils;

import java.security.MessageDigest;

/**
 * Hello world!
 */
public class TestApp {

    public static void main(String[] args) {
        try {
            byte[] source = "123".getBytes();

            byte[] b1 = EncryptUtils.encryptMD5(source).getBytes() ;

            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(source);
            //MD5的计算结果是一个128位的长整数，用字节表示为16个字节
            byte[] b2 = md.digest();

            System.out.println("第一种方式：");
            for(byte b : b1){
                System.out.print(b + " ");
            }
            System.out.println("");
            System.out.println("第二种方式：");
            for(byte b : b2){
                System.out.print(b + " ");
            }
            System.out.println("");

            System.out.println("*****" + "".getBytes().length);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
